package com.motherchild.admin.service.impl;

import com.motherchild.admin.dto.EmployeeDTO;
import com.motherchild.admin.mapper.EmployeeMapper;
import com.motherchild.admin.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EmployeeServiceImpl implements EmployeeService {
    @Autowired
    private EmployeeMapper employeeMapper;

    @Override
    public List<EmployeeDTO> getAllEmployees() {
        return employeeMapper.selectAllEmployees();
    }

    @Override
    public EmployeeDTO getEmployeeById(Long id) {
        return employeeMapper.selectEmployeeById(id);
    }

    @Override
    public void addEmployee(EmployeeDTO employeeDTO) {
        employeeMapper.insertEmployee(employeeDTO);
    }

    @Override
    public void updateEmployee(EmployeeDTO employeeDTO) {
        employeeMapper.updateEmployee(employeeDTO);
    }

    @Override
    public void deleteEmployee(Long id) {
        employeeMapper.deleteEmployee(id);
    }


    @Override
    public List<EmployeeDTO>  searchEmployee(EmployeeDTO employeeDTO) {
        return employeeMapper.searchEmployee(employeeDTO);
    }
}